#ifndef _BUOLA_SCENE_GEODES_CCLOTH_H_
#define _BUOLA_SCENE_GEODES_CCLOTH_H_

#include <buola/scene/cgeode.h>
#include <buola/scene/cvertexdata.h>
#include <BulletSoftBody/btSoftBody.h>

namespace buola { namespace scene {

class CCloth : public CGeode
{
public:
    CCloth(const std::array<mat::CVec3f,4> &pCorners,double pMass,int pXSegs=21,int pYSegs=21);
    ~CCloth();

    btSoftBody *MakeSoftBody(const PScene &pScene);
    
    void Render(CRenderContext &pContext) override;
    
private:
    std::array<mat::CVec3f,4> mCorners;
    double mMass;
    int mXSegs;
    int mYSegs;
    btSoftBody *mSoftBody;
    CVertexData mVertexData;
};

typedef intrusive_ptr<CCloth> PCloth;

/*namespace scene*/ } /*namespace buola*/ }

#endif
